import java.util.*;

public class Main {

    //
    public static void main1(String[] args){
        Scanner in= new Scanner(System.in);
        char[] s = in.next().toCharArray();

        int ret = -1;
        int n = s.length;
        for(int i = 0; i < n; i++){
            if(i + 1 < n && s[i] == s[i + 1]){
                ret = 2;
                break;
            }
            if(i + 2 < n && s[i] == s[i + 2]){
                ret = 3;
            }
        }
        System.out.println(ret);
    }

    //
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = in.nextInt();
        }

        int[] f = new int[n + 1];
        int[] g = new int[n + 1];
        for(int i = 1; i <= n; i++){
            f[i] = g[i - 1] + arr[i - 1];
            g[i] = Math.max(g[i - 1], f[i - 1]);
        }
        System.out.println(Math.max(f[n], g[n]));
    }

    //
    public static void main3(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), p = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = in.nextInt();
        }

        Arrays.sort(arr);
        int left = 0, right = 0, ret = 0;
        p *= 2;
        while(right < n){
            while(arr[right] - arr[left] > p){
                left++;
            }
            ret = Math.max(ret, right - left + 1);
            right++;
        }
        System.out.println(ret);
    }

    //
}
